<template>
    <div>
        <!--组织管理-->
        <div >
        <van-row>
            <Hearders />
            <van-col span="4">
                <Left />
            </van-col>
            <van-col span="4">
                <van-field label="组织名称"  placeholder="请输入"/> 
                <button>新增</button>&ensp;&ensp;
                <van-uploader :after-read="afterRead"  >
                    <button>导入</button>
                </van-uploader>&ensp;&ensp;
                <button @click="daochu">导出</button>

                <Mycomany @code="codevalue" />
                
            </van-col>
            <van-col span="4" style="padding-top: 10px ;">
                
                <button>查询</button>
                <button>重置</button>
            </van-col>
            </van-row>

        </div>
        

    </div>
</template>

<script>
import Hearders from '../comm/hearders'
import Mycomany from '../comm/mycomany'
import Left from '../comm/left.vue'
//分装
import axios from '../../http/axios'
//导出
import fileDownload from "js-file-download";
// import axios from 'axios'



export default {
components: { Hearders ,Left, Mycomany}, 
    data() {
        return {
                code:'',
                getuserlist:[],
                

            }
        },
    methods: {
                //导出
                daochu(){
                    axios('/comany/daochu/','get').then(res=>{
                        
                        fileDownload(res.data,'file.xls')
                    })
                },
                //导入
                afterRead(file){
                    console.log(file)
                    let formdata = new FormData()
                    formdata.append('file',file.file)
                    // axios({url:'/comany/daoru/',method:'post',data:formdata}).then(res=>{
                    //     console.log(res)
                    // })
                    axios('/comany/daoru/','post',formdata).then(res=>{
                        console.log(res)
                        
                    })
                },
                //接收子组件传的参数
                codevalue(codevalue){
                    
                    this.code = codevalue
                },
                
            
        },
        mounted() {
            
        },
        
            
    }
    
</script>

<style scoped>



</style>